package com.itheima01;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Test03 {
    public static void main(String[] args) {
       List<Integer> list=new ArrayList<Integer>();
       list.add(10);
       list.add(20);
       list.add(30);
       list.add(40);
       list.add(50);
        Iterator<Integer> iterator = list.iterator();
        while (iterator.hasNext()) {
            Integer next = iterator.next();
            System.out.println(next);
        }
        for (Integer iter : list) {
            System.out.println(iter);
        }
        list.forEach(s-> System.out.println(s));
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }


}
